/*
 * Copyright Notice ====================================================
 * This file contains proprietary information of Hewlett-Packard Co.
 * Copying or reproduction without prior written approval is prohibited.
 * Copyright (c) 2013 All rights reserved. =============================
 */

package com.hp.ecs.xqa.bo;

import java.io.Serializable;

import javax.inject.Inject;

import org.springframework.stereotype.Component;

import com.hp.ecs.xqa.util.orm.Dao;
import com.hp.ecs.xqa.util.orm.PageList;
import com.hp.ecs.xqa.vo.Defect;

@Component
public class DefectBo {
	@Inject
	private Dao dao;

	public Serializable save(String code, String stackTrace, String history) {
		Defect defect = new Defect();
		defect.setStackTrace(stackTrace);
		defect.setHistory(history);
		defect.setCode(code);
		return dao.insert(defect);
	}

	public PageList<Defect> getPage(int page, int pageSize) {
		return dao.page(page, pageSize, "from com.hp.ecs.xqa.vo.Defect");
	}
}
